﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TestProject;
using TestProject.Controllers;

namespace TestProject.Tests.Controllers
{
    [TestClass]
    public class HomeControllerTest
    {
        [TestMethod]
        public void Index()
        {
            // Arrange
            HomeController controller = new HomeController();

            // Act
            ActionResult actionResult = controller.Index();

            // Assert
            ViewResult result = actionResult as ViewResult;
            Assert.IsNotNull(result, "The result is not a view result");
            ViewDataDictionary viewData = result.ViewData;

            Assert.AreEqual("Index", result.ViewName);
            //Assert.AreEqual("AdminMaster",result.MasterName);

            Assert.AreEqual("Welcome to ASP.NET MVC!", viewData["Message"]);
        }

        [TestMethod]
        public void About()
        {
            // Arrange
            HomeController controller = new HomeController();

            // Act
            ActionResult actionResult = controller.About();

            // Assert
            ViewResult result = actionResult as ViewResult;
            Assert.IsNotNull(result, "The result is not a view result");

            ViewDataDictionary viewData = result.ViewData;
            Assert.AreEqual("About Page", viewData["Title"]);
        }
    }
}
